<template>
  <div class="message-list">
    <!-- 消息项 -->
    <div class="message-item" v-for="message in messages" :key="message.id">
      <img :src="message.avatar" alt="avatar" />
      <div class="message-info">
        <h4>{{ message.name }}</h4>
        <p>{{ message.content }}</p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    messages: {
      type: Array,
      required: true,
    },
  },
};
</script>

<style scoped>
.message-list {
  background-color: #fff;
  border-radius: 5px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.message-item {
  display: flex;
  padding: 10px;
  border-bottom: 1px solid #f0f0f0;
}

.message-item:last-child {
  border-bottom: none;
}

.message-item img {
  border-radius: 50%;
  margin-right: 10px;
  width: 40px;
  height: 40px;
}

.message-info {
  flex: 1;
}

.message-info h4 {
  margin: 0;
  font-size: 14px;
}

.message-info p {
  margin: 5px 0 0;
  color: #666;
  font-size: 12px;
}
</style>
